package demo.action;


import java.util.List;

import com.jfinal.core.Controller;
import com.jfinal.kit.JsonKit;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.jfinal.render.JsonRender;

public class TestTree extends Controller {
	public void index(){
		render("tree.jsp");
	}
	
	public void getDepartment(){
		List<Record> dept = Db.find("select DeptId id,ParentId pId,DeptName name from department");
		
//		JsonRender jsonStr = new JsonRender(JsonKit.toJson(dept, 15));
//		System.out.println(jsonStr);
		renderJson(dept);
//		renderText(jsonStr.getJsonText());
	}
}
